package com.hjms.mall.controller;

import com.hjms.mall.contracts.ISkuService;
import com.hjms.mall.contracts.dto.sku.AddSkuDto;
import com.hjms.mall.contracts.vo.sku.SkuVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 何杨谊
 * @description: 商品
 * @date 2022/12/31 21:23
 */
@Api(tags = "商品")
@RestController
@RequestMapping("api/sku")
public class SkuController {
    @Autowired
    private ISkuService skuService;

    /**
     * 新增商品
     * @param dto
     * @return
     */
    @PostMapping
    @ApiOperation(value = "新增商品")
    public String Add(@RequestBody AddSkuDto dto){
        return skuService.Add(dto);
    }

    /**
     * 获取商品信息
     * @param skuId
     * @return
     */
    @GetMapping("{skuId}")
    @ApiOperation(value = "获取商品信息")
    public SkuVo Get(@PathVariable(value = "skuId") String skuId){return  skuService.Get(skuId);}
}
